# cipher_utilities.py
#
# Various utility functions for encryption and decryption.
#

from random import randrange

###############################################################
# obfuscate
# This function obfuscates the character count of words in a 
# string by grouping capital characters in chunks of five.
def obfuscate(s):

    result = ""
    counter = 0
    chunk_size = 5
    for c in range(len(s)):
        if s[c].isalpha():
            result += s[c].upper()
            counter += 1
            if counter >= chunk_size:
                result += " " 
                counter = 0
    # Fill the remaining chunk spaces with characters
    if counter > 0:
        alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
        for i in range(chunk_size - counter):
            result += alphabet[randrange(0,26)]
             
    return result






